package net.app.zoneland.platform.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.app.zoneland.common.core.vo.Result;
import net.app.zoneland.platform.service.ISysRoleMenuService;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;

/**
 * @Description
 * @Author LENOVO
 * @CreateTime 2021/1/31 23:06
 * @Version: 1.0
 */
@Api(tags = "角色菜单接口")
@RestController
@RequestMapping("/roleMenu")
@Slf4j
@AllArgsConstructor
public class SysRoleMenuController {

    private final ISysRoleMenuService sysRoleMenuService;

    @ApiOperation(value="角色授权", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "authIds", value = "菜单集合", paramType = "String", dataType = "String")
    })
    @PostMapping("/updateAuth")
    public Result updateAuth(Integer roleId, String authId){
        if(roleId!=null && authId!=null && !"".equals(authId)){
            sysRoleMenuService.updateInfo(roleId,authId);
            return Result.success();
        }
        return Result.error();
    }

}
